package com.gao.controller;

import com.sun.org.apache.regexp.internal.RE;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Projectname SSM
 * @Filename RestfulController
 * @Author an
 * @Data 2022/8/5 9:42
 * @Description
 * 查询所有的用户信息--->/user--->get
 * 根据id查询用户信息--->/user/1--->get
 * 新增用户信息--->/user--->post
 * 删除用户信息--->/user/1--->delete
 * 更新用户信息--->/user--->put
 */
@Controller
public class RestfulController {

//    @RequestMapping(value = "/user",method = RequestMethod.GET)
    @GetMapping("/user")
    public String getAllUser(){
        System.out.println("查询所有的用户信息--->/user--->get");
        return "success";
    }

//    @RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    @GetMapping("/user/{id}")
    public String getUserById(@PathVariable("id") Integer id){
        System.out.println("根据id查询用户信息--->/user/"+id+"--->get");
        return "success";
    }

//    @RequestMapping(value = "/user",method = RequestMethod.POST)
    @PostMapping("/user")
    public  String insertUser(){
        System.out.println("新增用户信息--->/user--->post");
        return "success";
    }

//    @RequestMapping(value = "/user",method = RequestMethod.PUT)
    @PutMapping("/user")
    public  String iupdateUser(){
        System.out.println("更新用户信息--->/user--->put");
        return "success";
    }


//    @RequestMapping(value = "/user/{id}",method = RequestMethod.DELETE)
    @DeleteMapping("/user/{id}")
    public String deleteUserById(@PathVariable("id") Integer id){
        System.out.println("删除用户信息--->/user/"+id+"--->delete");
        return "success";
    }

}
